package com.xhd.base.session;

import com.xhd.base.log.Log;
import com.xhd.base.log.LogFactory;
import com.xhd.server.EventObject;
import com.xhd.server.ServerConfig;
import com.xhd.util.XThread;

public class SessionThread extends XThread
{
  private final int jm594 = 120000;
  private int jm595 = 1200000;
  private static final Log jm9;
  static Class jm10;

  static
  {
    Class tmp3_0 = jm10;
    if (tmp3_0 == null)
    {
     
      try
      {
        SessionThread.jm10 = Class.forName("com.sinocc.base.session.SessionThread");
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    jm9 = LogFactory.getLog(tmp3_0);
  }

  public SessionThread()
  {
    super(ServerConfig.SystemName + " Session Thread");
    if (ServerConfig.SessionMinutes >= 20)
      return;
    this.jm595 = (ServerConfig.SessionMinutes * 60000);
  }

  public void run()
  {
    SessionManager localSessionManager = SessionManager.getInstance();
    long l = System.currentTimeMillis() - 300000L;
    while (!(this.stop))
    {
      try
      {
        if (ServerConfig.AlwaysSaveSession)
        {
          sleep(120000L);
         // break label53:
        }
        sleep(this.jm595);
      }
      catch (InterruptedException localInterruptedException)
      {
        if (this.stop)
        	 jm9.info("Stop " + getName());
      }
      label53: localSessionManager.checkAll(l);
      l = System.currentTimeMillis();
    }
   
    try
    {
      ServerConfig.Event.onEvent(EventObject.TIME_AFTER | EventObject.EVENT_STOP_SYS);
    }
    catch (Throwable localThrowable)
    {
      localThrowable.printStackTrace();
    }
  }
}